import request from "../utils/request"

/**
 * 用户请求API
 */

// 用户登录
export const login = data => {
  return request({
    method: 'POST',
    url: '/authentication',
    data: data
  })
}

// 获取当前用户信息
export const getUserInfo = () => {
    return request({
        method: 'GET',
        url: '/getUserInfo'
    })
}

// 用户列表
export const getUserList = params => {
    return request({
        method: 'POST',
        url: '/queryUserByCondition',
        params: params
    })
}

// 新增用户
export const addUser = params => {
    return request({
        method: 'POST',
        url: '/addUser',
        data: params
    })
}

// 查询用户信息
export const queryUserById = params => {
    return request({
        method: 'GET',
        url: '/queryUserById',
        params: params
    })
}

// 查询用户拥有的角色信息
export const getUserOfRoleInfoByUsername = params => {
    return request({
        method: 'GET',
        url: '/getUserOfRoleInfoByUsername',
        params: params
    })
}

// 更新用户信息
export const updateUser = params => {
    return request({
        method: 'POST',
        url: '/updateUser',
        data: params
    })
}

// 更新用户密码
export const updateUserPassword = params => {
    return request({
        method: 'POST',
        url: '/updateUserPassword',
        data: params
    })
}
